#!/usr/bin/env bash
# declare a name for this job to be sample_job
#PBS -N genomic_feature  
# request the queue (enter the possible names, if omitted, serial is the default)
#PBS -q laird     
# request 1 node
#PBS -l nodes=1 
#PBS -l walltime=168:00:00,mem=8g
# join the standard output and error files
#PBS -j oe
# mail is sent to you when the job starts and when it terminates or aborts
#PBS -M yapingli@hpc-uec.usc.edu
# By default, PBS scripts execute in your home directory, not the 
# directory from which they were submitted. The following line 
# places you in the directory from which the job was submitted.  
cd $PBS_O_WORKDIR
# run the program

#echo "select distinct(featType) from features_chr11;" | mysql cr | grep ENCODEclst | perl -ne 'print "-feature $_";'
#echo "select distinct(featType) from features_chr11;" | mysql cr | grep Broad | perl -ne 'print "-feature $_";'

#/bin/ls -1 /Users/yaping/Documents/workspace/result/ASM/methylCGsRich_ASM_*.gtf | perl -ne 'chomp; `/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java -Xmx2g -jar /Users/yaping/Documents/workspace/featureCounter.jar $_  -feature tss -feature tss_1kb_flank -feature tss_2kb_flank -feature tss_500bp_flank -feature exon -feature EXON_NON_TSS -feature HELA_ENHNC_NOTSS_NOCTCF  -feature LINE  -feature SINE -feature MICROSAT -feature CTCF_CUDKIM -feature BroadClust500-Ctcf.gtf -feature CTCF_CUDKIM_XIE_300BP -feature CGIS_IRIZARRY_2009 -feature CAGE_TSR -feature RING1B_Ku2008  -feature K27me3_Ku2008  -feature TJ  -feature GG -feature BroadClust500-H3k27ac.gtf -feature BroadClust500-H3k27me3.gtf -feature BroadClust500-H3k36me3.gtf -feature BroadClust500-H3k4me1.gtf -feature BroadClust500-H3k4me2.gtf -feature BroadClust500-H3k4me3.gtf -feature BroadClust500-H3k9ac.gtf -feature BroadClust500-H3k9me1.gtf -feature BroadClust500-H4k20me1.gtf  -feature BroadClust500-Pol2b.gtf -feature ENCODEclst_CTCF -feature PMD_NORM_20-60_w10m100 -feature PMD_TUM_20-60_w10m100 > $_.feats.csv`'

/bin/ls -1 /home/uec-00/yapingli/code/Allele_specific_methylation/methylCGsRich_ASM_*.gtf | perl -ne 'chomp; `/home/uec-00/shared/production/software/java/default/bin/java -Xmx8g -jar /home/uec-00/yapingli/code/Allele_specific_methylation/featureCounter.jar $_  -feature tss -feature tss_1kb_flank -feature tss_2kb_flank -feature tss_500bp_flank -feature exon -feature EXON_NON_TSS -feature CGIS_IRIZARRY_2009 -feature CGIS_IRIZARRY_2009_INVERSE -feature CTCF_CUDKIM -feature CTCF_CUDKIM_2000BP -feature CTCF_CUDKIM_XIE_2000BP -feature CTCF_CUDKIM_XIE_3000BPWIND -feature CTCF_CUDKIM_XIE_300BP -feature ENCODEclst_CTCF -feature BroadClust500-Ctcf.gtf -feature BroadClust500-Ctcf-minsignalva -feature HELA_ENHNC_NOTSS_NOCTCF  -feature LINE  -feature SINE -feature MICROSAT -feature CAGE_TSR -feature RING1B_Ku2008 -feature SIMPLE_REPEATS -feature PMDTEST_IMR90_20-60_w20m100 -feature PMDTEST_NORM_18less_w10m0 -feature PMDTEST_NORM_18less_w20m0 -feature PMDTEST_NORM_20-60_w10m100 -feature PMDTEST_NORM_20-60_w20m10 -feature PMDTEST_NORM_20-60_w20m100 -feature PMDTEST_TUM_18less_w10m0 -feature PMDTEST_TUM_18less_w20m0 -feature PMDTEST_TUM_20-60_w10m100 -feature PMDTEST_TUM_20-60_w20m10 -feature PMDTEST_TUM_20-60_w20m100 -feature PMD_IMR90_20-60_w10m100 -feature PMD_IMR90_20-60_w10m100_20kbou -feature PMD_NORM_20-60_w10m100 -feature PMD_TUM_20-60_w10m100 -feature PMD_TUM_20-60_w10m100_20kbound -feature BroadClust500-H3k27ac-minsigna -feature BroadClust500-H3k27ac.gtf -feature BroadClust500-H3k27me3-minsign -feature BroadClust500-H3k27me3.gtf -feature BroadClust500-H3k36me3-minsign -feature BroadClust500-H3k36me3.gtf -feature BroadClust500-H3k4me1-minsigna -feature BroadClust500-H3k4me1.gtf -feature BroadClust500-H3k4me2-minsigna -feature BroadClust500-H3k4me2.gtf -feature BroadClust500-H3k4me3-minsigna -feature BroadClust500-H3k4me3.gtf -feature BroadClust500-H3k9ac-minsignal -feature BroadClust500-H3k9ac.gtf -feature BroadClust500-H3k9me1-minsigna -feature BroadClust500-H3k9me1.gtf -feature BroadClust500-H4k20me1-minsign -feature BroadClust500-H4k20me1.gtf -feature BroadClust500-Pol2b-minsignalv -feature BroadClust500-Pol2b.gtf -feature ENCODEclst_c-Myc > $_.feats.csv`'
exit 0
